package JavaCodePublicClass.棋盘;

import javax.swing.*;
import java.awt.*;

public class qipan
{
    public static void main(String[] args)
    {
        JFrame f = new JFrame("国际象棋几盘");
        f.setSize(600, 600);
        Point point = new Point(350, 200);
        f.setLocation(point);
        int grids = 100;
        int gridssize = 20;
        for (int i = 0; i < grids; i++)
        {
            for (int j = 0; j < grids; j++)
            {
                JLabel l = new JLabel();
                l.setSize(gridssize, gridssize);
                l.setLocation(i * gridssize, gridssize);
                if ((i + j) % 2 == 0)
                {
                    l.setBackground(Color.black);
                    l.setOpaque(true);
                } else
                {
                    l.setBackground(Color.white);
                    l.setOpaque(true);
                }
                l.setBorder(BorderFactory.createLineBorder(Color.black));
                f.add(l);

            }
        }
        f.setVisible(true);
    }
}
